package com.econ.powercloud.ems.rpc.callback;

import com.econ.powercloud.common.base.facade.enums.StatusType;
import com.econ.powercloud.common.base.facade.pojo.MsgResult;
import com.econ.powercloud.console.facade.domain.*;
import com.econ.powercloud.common.base.facade.pojo.PageResult;
import com.econ.powercloud.ems.rpc.IFeignPowerNodeConsoleClient;
import feign.hystrix.FallbackFactory;

import java.util.List;

/**
 * @Author : zjf
 * @Description :
 * @Date : 2022/3/23 10:23
 * @Modified by : zjf
 */
public class IFeignPowerNodeConsoleFallbackFactory implements FallbackFactory<IFeignPowerNodeConsoleClient> {

    @Override
    public IFeignPowerNodeConsoleClient create(Throwable cause) {
        return new IFeignPowerNodeConsoleClient() {
            @Override
            public MsgResult<Integer> yk(String clientIp,Integer msgId, String deviceCode, String dit, Integer value, Boolean preSend) {
                MsgResult.MsgResultBuilder<Integer> builder = MsgResult.builder();
                return builder.status(StatusType.FAIL.getCode()).statusText("降级熔断").build();
            }

            @Override
            public MsgResult<Integer> yt(String clientIp,Integer msgId, String deviceCode, String dit, Double value, Boolean preSend) {
                MsgResult.MsgResultBuilder<Integer> builder = MsgResult.builder();
                return builder.status(StatusType.FAIL.getCode()).statusText("降级熔断").build();
            }

            @Override
            public MsgResult<Integer> strategy(String clientIp,String deviceCode, EdgeStrategyRequestVO requestVO) {
                MsgResult.MsgResultBuilder<Integer> builder = MsgResult.builder();
                return builder.status(StatusType.FAIL.getCode()).statusText("降级熔断").build();
            }

            @Override
            public MsgResult<List<String>> searchClientIp() {
                MsgResult.MsgResultBuilder<List<String>> builder = MsgResult.builder();
                return builder.status(StatusType.FAIL.getCode()).statusText("降级熔断").build();
            }

            @Override
            public MsgResult<PageResult<List<EdgePlatformSyncMsgVO>>> searchDeviceOperationRecord(EdgePlatformSyncMsgSearchRequestVO requestVO) {
                MsgResult.MsgResultBuilder<PageResult<List<EdgePlatformSyncMsgVO>>> builder = MsgResult.builder();
                return builder.status(StatusType.FAIL.getCode()).statusText("降级熔断").build();
            }

            @Override
            public MsgResult<EdgePlatformSyncMsgDetailVO> msgDetails(Integer msgPid) {
                MsgResult.MsgResultBuilder<EdgePlatformSyncMsgDetailVO> builder = MsgResult.builder();
                return builder.status(StatusType.FAIL.getCode()).statusText("降级熔断").build();
            }

            @Override
            public MsgResult<Integer> callHisPg(String clientIp,String deviceCode, Integer start, Integer end) {
                MsgResult.MsgResultBuilder<Integer> builder = MsgResult.builder();
                return builder.status(StatusType.FAIL.getCode()).statusText("降级熔断").build();
            }

            @Override
            public MsgResult<Integer> callHisSoe(String clientIp,String deviceCode, Integer start, Integer end) {
                MsgResult.MsgResultBuilder<Integer> builder = MsgResult.builder();
                return builder.status(StatusType.FAIL.getCode()).statusText("降级熔断").build();
            }

            @Override
            public MsgResult<CloudControlVO> search() {
                MsgResult.MsgResultBuilder<CloudControlVO> builder = MsgResult.builder();
                return builder.status(StatusType.FAIL.getCode()).statusText("降级熔断").build();
            }

            @Override
            public MsgResult<Integer> cloudSwitch(String clientIp,Integer onoff) {
                MsgResult.MsgResultBuilder<Integer> builder = MsgResult.builder();
                return builder.status(StatusType.FAIL.getCode()).statusText("降级熔断").build();
            }

            @Override
            public MsgResult<SysMasterSlaveVO> getInfo() {
                MsgResult.MsgResultBuilder<SysMasterSlaveVO> builder = MsgResult.builder();
                return builder.status(StatusType.FAIL.getCode()).statusText("降级熔断").build();
            }

            @Override
            public MsgResult<String> modifyAccessMethod(SysMasterSlaveEdit edit) {
                MsgResult.MsgResultBuilder<String> builder = MsgResult.builder();
                return builder.status(StatusType.FAIL.getCode()).statusText("降级熔断").build();
            }

            @Override
            public MsgResult<Integer> pushListing(String deviceCode, Integer type, Integer value) {
                MsgResult.MsgResultBuilder<Integer> builder = MsgResult.builder();
                return builder.status(StatusType.FAIL.getCode()).statusText("降级熔断").build();
            }
        };
    }
}
